package com.api.wall.deleteprivatecomment;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IWallApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/wall/wall-context.xml" })
public class DeletePrivateCommentInvalid extends AbstractApiTest {

	@Value("#{org_wall[privateCommenter].appId}")
	private String commenterUrn;

	@Value("#{org_wall[privateCommenter].password}")
	private String commenterPassword;

	@Value("#{org_wall[userToNotify].appId}")
	private String notifiedUserUrn;

	@Value("#{org_wall[userToNotify].password}")
	private String notifiedUserPassword;

	private String eventToDeleteUrn;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(commenterUrn, commenterPassword);

		List<String> usersToNotify = new ArrayList<String>();
		usersToNotify.add(notifiedUserUrn);

		this.eventToDeleteUrn = getApi().getService(IWallApiService.class).publishPrivateComment("comment", null, null, null, null,
				usersToNotify);

		getApi().login(notifiedUserUrn, notifiedUserPassword);
	}

	@Test(expectedExceptions = ZyncroApiException.class)
	public void testPublishCompanyFeed() throws ZyncroApiException {

		getApi().getService(IWallApiService.class).deletePrivateComment(eventToDeleteUrn);
	}
}
